#Java - Code Snippets for '#CharSetUtils (Apache Commons)' - 2 code snippet(s) found |
|
Sample 1. Remove Numbers from a String using CharSetUtils (Apache Commons) | |
|
String str = new String("1H4ello1 World2");
String newStr = CharSetUtils.delete(str, "1234567890");
System.out.println(newStr); // prints Hello World
|
|
Like Feedback Apache Commons CharSetUtils Remove Numbers from String |
|
|
Sample 2. Check if the String contains specified characters using CharSetUtils (Apache Commons) | |
|
System.out.println(CharSetUtils.containsAny("Whats Up ?", "W")); // Prints true as the String contains character W System.out.println(CharSetUtils.containsAny("Whats Up ?", "YZ")); // Prints false as the String doesn't contain character Y or Z
|
|
Like Feedback CharSetUtils (Apache Commons) Check if String contains characters |
|
|